#pragma once
template<class Iterator,class Ref,class Ptr>
struct Reverse_iterator
{
	typedef Reverse_iterator<Iterator,Ref,Ptr> Self;

	Iterator cur;

	Reverse_iterator(Iterator it)
		:cur(it)
	{ }

	Ref operator*()
	{
		Iterator tmp(cur);
		return *(--tmp);
	}

	Ref operator->()
	{
		return &(operator*());
	}

	Self& operator++()
	{
		--cur;
		return *this;
	}

	Self& operator++(int)
	{
		Self temp(cur);
		--cur;
		return temp;

	}
	Self& operator--()
	{
		++cur;
		return *this;
	}

	Self& operator--(int)
	{
		Self temp = cur;
		++cur;
		return temp;
	}

	bool operator!=(const Self& s)
	{
		return cur != s.cur;
	}

	bool operator==(const Self& s)
	{
		return cur == s.cur;
	}
};